package com.smedi.ismedi.personnel.api.dto.response;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.util.StringUtils;

import java.io.Serializable;

/**
 * @Author: xulinjun
 * @Date: 2021-6-13 11:10
 */
@Data
@Accessors(chain = true)
public class UploadPersonTemplateRowResponse implements Serializable {
    @ApiModelProperty(value = "企业组织名称")
    private String hrOrganizationName;

    @ApiModelProperty(value = "项目组织名称")
    private String projectOrganizationName;

    @ApiModelProperty(value = "姓名")
    private String lastName;

    @ApiModelProperty(value = "手机号")
    private String mobile;

    @ApiModelProperty(value = "性别含义")
    private String genderName;

    @ApiModelProperty(value = "性别")
    private String gender;

    @ApiModelProperty(value = "工号")
    private String employeeNum;

    @ApiModelProperty(value = "从事职务")
    private String hrJob;

    @ApiModelProperty(value = "项目职务")
    private String projectJob;

    @ApiModelProperty(value = "邮箱")
    private String email;

    @ApiModelProperty(value = "座机")
    private String officeTelephone;

    @ApiModelProperty(value = "身份证")
    private String idCard;

    @ApiModelProperty(value = "已校验")
    private boolean validated;

    @ApiModelProperty(value = "已保存")
    private boolean saved;

    @ApiModelProperty(value = "错误消息")
    private String errorMessage;

    public void setIdCard(String idCard) {
        // 返回前端脱敏处理
        String idCardText = idCard;
        if (!StringUtils.isEmpty(idCard)) {
            idCardText = idCard.substring(0, idCardText.length() - 6) + "******";
        }
        this.idCard = idCardText;
    }

    public String getGender() {
        if (this.gender.equals("M") || this.gender.equals("MALE")) {
            return "MALE";
        } else {
            return "FEMALE";
        }
    }
}
